package datastructure.array

import org.junit.jupiter.api.Test
import java.util.*
import kotlin.test.assertEquals

class DynamicArrayTests {
    @Test
    fun dynamicArrayTest() {
        val scan = Scanner(DynamicArrayTests::class.java.getResourceAsStream("/dynamicArray.txt"))
        val nq = scan.nextLine().trimEnd().split(" ")

        val n = nq[0].toInt()

        val q = nq[1].toInt()

        val queries = Array<Array<Int>>(q, { Array<Int>(3, { 0 }) })

        for (i in 0 until q) {
            queries[i] = scan.nextLine().trimEnd().split(" ").map { it.toInt() }.toTypedArray()
        }

        val result = dynamicArray(n, queries)

        println(result.joinToString("\n"))
        assertEquals(scan.nextLine().trim(), result.joinToString(" "))
    }
}